// 路由鉴权文件

import router from "./router";

const token = localStorage.getItem("token");

// 前置守卫
router.beforeEach((to, form, next) => {
    console.log()
  if (to.meta.isAuthor && !token) {
    next({ path: "/login", query: { cb: to.path } });
  } else {
    next();
  }
});

// 后置守卫
router.afterEach((to, form) => {
  document.title = to.meta.title;
});
